//
//  NoteCommentMode.m
//  DogeLegs
//
//  Created by 宋华 on 2017/8/22.
//  Copyright © 2017年 宋华. All rights reserved.
//

#import "NoteCommentMode.h"

@implementation NoteCommentMode
+ (NSMutableArray *)noteCommentModeFromData:(NSArray *)coms {
    if (![coms isKindOfClass:[NSArray class]]) {
        return nil;
    }
    NSMutableArray *cs = [NSMutableArray array];
    for (NSDictionary *dics in coms) {
        NoteCommentMode *cmMode = [NoteCommentMode noteCommentModeFromDict:dics];
        [cs addObject:cmMode];
    }
    return cs;
}

+ (NoteCommentMode *)noteCommentModeFromDict:(NSDictionary *)dics {
    if (![dics isKindOfClass:[NSDictionary class]]) {
        return nil;
    }
    NoteCommentMode *noteMode = [[NoteCommentMode alloc] init];
    
    
    
    return noteMode;
}

- (NSString *)comContentStr {
    if (self.toUser) {
        return [NSString stringWithFormat:@"@%@ %@",self.toUser.userName,self.commentContent];
    }
    return self.commentContent;
}

+ (NSMutableArray *)testComModes {
    NSMutableArray *test = [NSMutableArray array];
    for (NSInteger i = 0; i < 6; i++) {
        NoteCommentMode *mode = [[NoteCommentMode alloc] init];
        mode.commentContent = @"Can you sell for lower price";
        UserMode *userMode = [[UserMode alloc] init];
        userMode.userName = @"Felicia  Ma";
        userMode.userId = [NSString stringWithFormat:@"%ld",199+i];
        userMode.headPortraitUrl = @"http://img2.100bt.com/upload/ttq/20131103/1383470553132_middle.jpg";
        mode.user = userMode;
        UserMode *touser = [[UserMode alloc] init];
        touser.userName = @"songxuhua";
        touser.userId = @"100";
        mode.toUser = touser;
        mode.commentDateStr = @"3 days ago";
        [test addObject:mode];
    }
    return test;
}


- (NSString *)commentDateStr {
    return [DateConvert displayDateStr:self.commentDate];
}


@end
